package com.mlnx.netty.weice;


import com.mlnx.netty.base.handler.EventHandle;
import com.mlnx.netty.base.handler.PushSugarHandle;
import com.mlnx.netty.weice.handler.WeiceServerHandle;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

/**
 * Created by amanda.shan on 2019/10/9.
 */
public class SugarServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
//        ch.pipeline().addLast(new LoggingHandler());
        ch.pipeline().addLast(new EventHandle());
        ch.pipeline().addLast(new LineBasedFrameDecoder(4096));
        ch.pipeline().addLast(new StringDecoder());
        ch.pipeline().addLast(new StringEncoder());
        ch.pipeline().addLast(new WeiceServerHandle());
        ch.pipeline().addLast(new PushSugarHandle());
    }
}
